#include "University.h"
#include "Student_t.h"
#include "StudentFactory.h"
#include <iostream>
#include <string>
#include <list>
using namespace std;
int main(){
	University_t* uni = University_t::getInstance();

	cout << "Welcome to university messages registration system!" << endl;
	bool cont = true;
	unsigned char c;
	list<Student_t> students;
	while(cont){
		cout	
				<< "	0: Create a student"								<< endl
				<< "	1: Raise tution"									<< endl
				<< "	2: Cancel exact science class"						<< endl
				<< "	3: Exit"											<< endl
				<< "Enter your choice: ";
		cin.width(1);
		cin >> c;
		if(c < '0' || c > '3'){
			cout << endl << "Please enter a valid choice" << endl;
			continue;
		}
		switch(c){
			case '0':
				{
				//create a student
				cout << endl << "Student name: ";
				string name;
				cin.width(15);
				cin >> name;
				cout << endl << "Faculty: ";
				string faculty;
				while(true){
					cin.width(3);
					cin >> faculty;
					if(faculty.compare("ESF") != 0 && faculty.compare("FON") != 0){
						cout << endl << "Faculty can be ESF or FON, please try again" << endl;
						faculty.clear();
						continue;
					}
					break;
				}
				Student_t student(name,faculty);
				if(faculty.compare("ESF") == 0){
					student.RegisterToSubject(uni,EVENT_ESF);
				}else{
					student.RegisterToSubject(uni,EVENT_FOH);
				}
				students.push_back(student);
				cout << endl << "Student created succesfully" << endl;
				}
				break;
			case '1':
				{
				cout << endl << "Raising tution again!" << endl;
				uni->RaisePrice();
				}
				break;
			case '2':
				{
				cout << endl << "Cancelling exact science next class" << endl;
				uni->CancelLecture();
				}
				break;
			default:
				cont = false;
				break;
		}
	}
	return 0;
}